package appConfig

import (
	"fmt"
	"github.com/spf13/viper"
)

type Mysql struct {
	User     string
	Passwd   string
	Host     string
	Port     int64
	Database string
}

type Redis struct {
	Addr   string
	Passwd string
}

type AppConfig struct {
	Mysql
	Redis
}

var ConfigData AppConfig

func Init() {
	viper.SetConfigFile("D:\\gowork\\src\\zk\\zg3_zk2\\src\\pro\\appConfig\\config.yaml")

	err := viper.ReadInConfig()
	if err != nil {
		return
	}
	err = viper.Unmarshal(&ConfigData)
	if err != nil {
		return
	}
	fmt.Println(ConfigData)
}
